package org.bees.cms.web.action;

import java.util.Map;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;
import org.bees.cms.common.Generic;

import com.opensymphony.xwork2.Action;

public abstract class ActionSupport<D> extends Generic<D> implements Action {
	public static final String MESSAGE = "message";

	protected static final ServletContext context = ServletActionContext.getServletContext();
	protected static final Map<String, Object> application = ServletActionContext.getContext().getApplication();
	protected HttpSession session = ServletActionContext.getRequest().getSession();
	protected HttpServletRequest request = ServletActionContext.getRequest();
	protected HttpServletResponse response = ServletActionContext.getResponse();

	@Override
	public String execute() throws Exception {
		return doExecute();
	}

	protected abstract String doExecute() throws Exception;

}
